#include "packetdata.h"

PacketData::PacketData(unsigned int totalParts): totalParts(totalParts) { }

PacketData::~PacketData() { }

void PacketData::addPart(unsigned int partNumber, QString message) {
	this->parts.insert(partNumber, message);
}

QString PacketData::getMessage() {
	QString result;

	for(unsigned int i = 1; i <= this->totalParts; i++)
		if(this->parts.contains(i))
			result += this->parts[i];

	return result;
}

bool PacketData::isComplete() {
	for(unsigned int i = 1; i <= this->totalParts; i++)
		if(this->parts.contains(i) == false)
			return false;

	return true;
}
